
import java.lang.reflect.Array;
import java.util.*;
import java.util.stream.Stream;

public class bitch {
    enum signal{
        sij(1),
         s(1);
        signal(int m){

        }

    }
   static int[][] array=new int[8][8];
   static int si;
   static int h=0;
   static void sit(int m,int n,int s,int j,int size){

        int right=size/2+m;
        int left=size/2+n;
        if(size==1) return;
        else if(s<right&&j<left){
            int time=h++;
            array[right-1][left]=time;
            array[right][left]=time;
            array[right][left-1]=time;
            sit(m,left,right-1,left,size/2);
            sit(m,n,s,j,size/2);
            sit(right,n,right,left-1,size/2);
            sit(right,left,right,left,size/2);

        }
        else if(s<right&&j>=left){
            int time=h++;
            array[right-1][left-1]=time;
            array[right][left]=time;
            array[right][left-1]=time;
            sit(m,left,s,j,size/2);
            sit(m,n,right-1,left-1,size/2);
            sit(right,n,right,left-1,size/2);
            sit(right,left,right,left,size/2);

        }
        else if(s>=right&&j<left){
            int time=h++;
            array[right-1][left-1]=time;
            array[right][left]=time;
            array[right-1][left]=time;
            sit(m,left,right-1,left,size/2);
            sit(m,n,right-1,left-1,size/2);
            sit(right,n,s,j,size/2);
            sit(right,left,right,left,size/2);

        }
        else if(s>=right&&j>=left){
            int time=h++;
            array[right-1][left-1]=time;
            array[right-1][left]=time;
            array[right][left-1]=time;
            sit(m,left,right-1,left,size/2);
            sit(m,n,right-1,left-1,size/2);
            sit(right,n,right,left-1,size/2);
            sit(right,left,s,j,size/2);

        }



    }
    ArrayList< Integer> a=new ArrayList();




    public static void main(String[] args) {




        int[] a=new int[]{1,2,3,2,6,5,0};
        quike(a,0,6);
        System.out.println(Arrays.toString(a));


    }








//致命快排，搞好边界条件，i，j的关系，先i再j可能会把j停在大的数上面，先j再i，j肯定是停在小的上面
    static int sitt(int[] a,int l,int r){
       int i=l;
       int j=r;
       int s;
       while(i<j){

           while (a[i]<=a[l]&&i<j)i++;
           while(a[j]>a[l]&&i<j)j--;
//最后指针要停在小号上面，所以大指针先行
           if(i>=j)break;
           s=a[i];
           a[i]=a[j];
           a[j]=s;
       }
       s=a[j];
       a[j]=a[l];
       a[l]=s;
       int sj[];
       sj=new int[5];
       return j;
    }

    static void quike(int[] a,int l,int r){

       if(l<r){
          int m=sitt(a,l,r);
          quike(a,l,m-1);
          quike(a,m+1,r);


       }

    }

    static int[][] string(String a,String b){

       int[][] m=new int[10][10];
       int[][] n=new int[10][10];
        ArrayList as=new ArrayList();



       for(int i=0;i<a.length();i++){
           int position=b.length();

           for(int j=0;j<b.length();j++) {
               if (a.charAt(i) == b.charAt(j)) {
                   if(i==0||j==0)m[i][j]=1;
                   else m[i][j] = m[i-1][j-1]+1;
                   n[i][j]=1;
               }
               else if(i==0||j==0)m[i][j]=0;
               else if(m[i][j-1]>m[i-1][j]){
                   m[i][j]=m[i][j-1];
                   n[i][j]=2;

               }
               else {
                   m[i][j]=m[i-1][j];
                   n[i][j]=3;
               }
           }
       }

        System.out.println(m[9][9]);
       return n;


    }

    static void print(String a,int[][] b,int i,int j){

       if(i<0||j<0)return;
       if(b[i][j]==1) {
           System.out.println(a.charAt(i));
           print(a,b,i-1,j-1);
       }
       else if(b[i][j]==2)print(a,b,i,j-1);
       else print(a,b,i-1,j);


    }

    static void bag(int[] v,int[] w,int size,int[][] dp){
       int dpp;

       for(int i=0;i<=-size;i++){
           for(int j=0;j<v.length;j++){
               if(i>=w[j]){
                   if(i==0)dp[j][i]=v[j];
                   else;
                   dp[j][i]=Math.max(dp[j-1][i],dp[j-1][i-w[j]]+v[j]);
               }
               else {
                   if(j==0)dp[j][i]=0;
                   else
                   dp[j][i]=dp[j-1][i];
                   int a=dp['1']['a'];

               }
           }
       }
for(int i=0;i<5;i++)
        System.out.println(Arrays.toString(dp[i]));
    }

    class School{
        private int sc_num;
        private String sc_name;
        public int pro_profession;

        School(){};

        School(int sc_num,String sc_name,int pro_profession){
            this.pro_profession=pro_profession;
            this.sc_name=sc_name;
            this.sc_num=sc_num;
        }
        public int getSc_num(){
            return sc_num;
        }

        public String getSc_name(){
            return sc_name;
        }

        public void setSc_num(int sc_num) {
            this.sc_num = sc_num;
        }

        public void setSc_name(String sc_name) {
            this.sc_name = sc_name;
        }

        public void setPro_profession(int pro_profession) {
            this.pro_profession = pro_profession;
        }

        @Override
        public String toString() {
            return "这里是：'" + sc_name + '\'' + "编号为：" + sc_num;
        }

        public String evaluate(int pro_profession){
            String res;
            if(pro_profession>20)res="恭喜贵校的评级为A";
            else res="恭喜贵校的评级为Bmmmmmmmmm";
            System.out.println(5^1);
            return res;
        }
    }
    static class instance{
        volatile static instance in;
        private instance(){};
        public static instance getinstance(){
            if(in!=null){
                return in;
            }
            synchronized (instance.class){
                if(in!=null)in=new instance();
            }
            return in;
        }

    }

    class College extends School{
        public  int hi_num;
        private String col_grade;
        private String col_name;

        College(int hi,int pro_pro,int sc_num,String sc_name){
            hi_num=hi;
            super.setPro_profession(pro_pro);
            super.setSc_name(sc_name);
            super.setSc_num(sc_num);

        }

        @Override
        public String toString() {
            return "学院名称" +col_name+ '\''+
                    "学院级别'" + col_grade + '\''+
                    "学校名称"+getSc_name()+ '\''
                    +"学校编号"+getSc_num();

        }

        public int getHi_num() {
            return hi_num;
        }

        public void setHi_num(int hi_num) {
            this.hi_num = hi_num;
        }

        public String getCol_grade() {
            return col_grade;
        }

        public void setCol_grade(String col_grade) {
            this.col_grade = col_grade;
        }

        public String getCol_name() {
            return col_name;
        }

        public void setCol_name(String col_name) {
            this.col_name = col_name;
        }


        public void evaluate(int pro,int emp) {
            if(pro>3&&emp>50)
                col_grade="A";
            else col_grade="B";
        }
    }






}
